package com.suixinsanren.design.observer.demo01;

import sun.management.ThreadInfoCompositeData;

public class Main {

    public static void main(String[] args) {

        WeatherData weatherData = new WeatherData();

        StatisticsDisplay statisticsDisplay = new StatisticsDisplay();
        ThirdPartyDisplay thirdPartyDisplay = new ThirdPartyDisplay();

        // 此时还没有观察者订阅，所以更新没有记录
        weatherData.update(20d,20d,10d);

        weatherData.addObserver(statisticsDisplay);
        weatherData.addObserver(thirdPartyDisplay);

        weatherData.update(30d,20d,10d);

        weatherData.update(40d,20d,10d);
    }
}
